package com.hjh.netty.elect.demo4;

import com.hjh.netty.elect.util.DataConvertUtils;
import com.hjh.netty.elect.util.NumberDataConvertUtils;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * 基本电能数据 (子类=0x02，版本=0)
 * @author pyz
 *
 */
@Service("analysisBasicEnergyUpLoadDataService")
public class AnalysisBasicEnergyUpLoadDataService implements AnalysisUpLoadDataService{
	
	@Override
	public SubType2TypeVer0 analysisUpLoadData(String upLoadData) {
		int index = 0;
		SubType2TypeVer0 result = new SubType2TypeVer0();
		//正向有功电能  格式：int32，单位：0.01kWh
		String kWhImp = upLoadData.substring(index, index + 8);
		result.setKWhImp(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhImp), new BigDecimal("0.01")));
		index += 8;
		//反向有功电能  格式：int32，单位：0.01kWh
		String kWhExp = upLoadData.substring(index, index + 8);
		result.setKWhExp(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhExp), new BigDecimal("0.01")));
		index += 8;
		//有功电能净值  格式：int32，单位：0.01kWh
		String kWhNet = upLoadData.substring(index, index + 8);
		result.setKWhNet(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhNet), new BigDecimal("0.01")));
		index += 8;
		//有功电能总和  格式：int32，单位：0.01kWh
		String kWhTot = upLoadData.substring(index, index + 8);
		result.setKWhTot(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhTot), new BigDecimal("0.01")));
		index += 8;
		//正向无功电能  格式：int32，单位：0.01kvarh
		String kvarhImp = upLoadData.substring(index, index + 8);
		result.setKvarhImp(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhImp), new BigDecimal("0.01")));
		index += 8;
		//反向无功电能  格式：int32，单位：0.01kvarh
		String kvarhExp = upLoadData.substring(index, index + 8);
		result.setKvarhExp(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhExp), new BigDecimal("0.01")));
		index += 8;
		//无功电能净值  格式：int32，单位：0.01kvarh
		String kvarhNet = upLoadData.substring(index, index + 8);
		result.setKvarhNet(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhNet), new BigDecimal("0.01")));
		index += 8;
		//无功电能总和  格式：int32，单位：0.01kvarh
		String kvarhTot = upLoadData.substring(index, index + 8);
		result.setKvarhTot(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhTot), new BigDecimal("0.01")));
		index += 8;
		//视在电能  格式：int32，单位：0.01kVAh
		String kVAh = upLoadData.substring(index, index + 8);
		result.setKVAh(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kVAh), new BigDecimal("0.01")));
		index += 8;
		//第一象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ1 = upLoadData.substring(index, index + 8);
		result.setKvarhQ1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ1), new BigDecimal("0.01")));
		index += 8;
		//第二象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ2 = upLoadData.substring(index, index + 8);
		result.setKvarhQ2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ2), new BigDecimal("0.01")));
		index += 8;
		//第三象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ3 = upLoadData.substring(index, index + 8);
		result.setKvarhQ3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ3), new BigDecimal("0.01")));
		index += 8;
		//第四象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ4 = upLoadData.substring(index, index + 8);
		result.setKvarhQ3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ4), new BigDecimal("0.01")));
		index += 8;
		//A 相正向有功电能  格式：int32，单位：0.01kWh
		String kWhImp1 = upLoadData.substring(index, index + 8);
		result.setKWhImp1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhImp1), new BigDecimal("0.01")));
		index += 8;
		//A 相反向有功电能  格式：int32，单位：0.01kWh
		String kWhExp1 = upLoadData.substring(index, index + 8);
		result.setKWhExp1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhExp1), new BigDecimal("0.01")));
		index += 8;
		//A 相有功电能净值  格式：int32，单位：0.01kWh
		String kWhNet1 = upLoadData.substring(index, index + 8);
		result.setKWhNet1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhNet1), new BigDecimal("0.01")));
		index += 8;
		//A 相有功电能总和  格式：int32，单位：0.01kWh
		String kWhTot1 = upLoadData.substring(index, index + 8);
		result.setKWhTot1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhTot1), new BigDecimal("0.01")));
		index += 8;
		//A 相正向无功电能  格式：int32，单位：0.01kvarh
		String kvarhImp1 = upLoadData.substring(index, index + 8);
		result.setKvarhImp1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhImp1), new BigDecimal("0.01")));
		index += 8;
		//A 相反向无功电能  格式：int32，单位：0.01kvarh
		String kvarhExp1 = upLoadData.substring(index, index + 8);
		result.setKvarhExp1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhExp1), new BigDecimal("0.01")));
		index += 8;
		//A 相无功电能净值  格式：int32，单位：0.01kvarh
		String kvarhNet1 = upLoadData.substring(index, index + 8);
		result.setKvarhNet1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhNet1), new BigDecimal("0.01")));
		index += 8;
		//A 相无功电能总和  格式：int32，单位：0.01kvarh
		String kvarhTot1 = upLoadData.substring(index, index + 8);
		result.setKvarhTot1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhTot1), new BigDecimal("0.01")));
		index += 8;
		//A 相视在电能  格式：int32，单位：0.01kVAh
		String kVAh1 = upLoadData.substring(index, index + 8);
		result.setKVAh1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kVAh1), new BigDecimal("0.01")));
		index += 8;
		//A 相第一象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ1_1 = upLoadData.substring(index, index + 8);
		result.setKvarhQ1_1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ1_1), new BigDecimal("0.01")));
		index += 8;
		//A 相第二象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ2_1 = upLoadData.substring(index, index + 8);
		result.setKvarhQ2_1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ2_1), new BigDecimal("0.01")));
		index += 8;
		//A 相第三象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ3_1 = upLoadData.substring(index, index + 8);
		result.setKvarhQ3_1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ3_1), new BigDecimal("0.01")));
		index += 8;
		//A 相第四象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ4_1 = upLoadData.substring(index, index + 8);
		result.setKvarhQ4_1(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ4_1), new BigDecimal("0.01")));
		index += 8;
		//B 相正向有功电能  格式：int32，单位：0.01kWh
		String kWhImp2 = upLoadData.substring(index, index + 8);
		result.setKWhImp2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhImp2), new BigDecimal("0.01")));
		index += 8;
		//B 相反向有功电能  格式：int32，单位：0.01kWh
		String kWhExp2 = upLoadData.substring(index, index + 8);
		result.setKWhExp2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhExp2), new BigDecimal("0.01")));
		index += 8;
		//B 相有功电能净值  格式：int32，单位：0.01kWh
		String kWhNet2 = upLoadData.substring(index, index + 8);
		result.setKWhNet2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhNet2), new BigDecimal("0.01")));
		index += 8;
		//B 相有功电能总和  格式：int32，单位：0.01kWh
		String kWhTot2 = upLoadData.substring(index, index + 8);
		result.setKWhTot2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhTot2), new BigDecimal("0.01")));
		index += 8;
		//B 相正向无功电能  格式：int32，单位：0.01kvarh
		String kvarhImp2 = upLoadData.substring(index, index + 8);
		result.setKvarhImp2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhImp2), new BigDecimal("0.01")));
		index += 8;
		//B 相反向无功电能  格式：int32，单位：0.01kvarh
		String kvarhExp2 = upLoadData.substring(index, index + 8);
		result.setKvarhExp2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhExp2), new BigDecimal("0.01")));
		index += 8;
		//B 相无功电能净值  格式：int32，单位：0.01kvarh
		String kvarhNet2 = upLoadData.substring(index, index + 8);
		result.setKvarhNet2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhNet2), new BigDecimal("0.01")));
		index += 8;
		//B 相无功电能总和  格式：int32，单位：0.01kvarh
		String kvarhTot2 = upLoadData.substring(index, index + 8);
		result.setKvarhTot2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhTot2), new BigDecimal("0.01")));
		index += 8;
		//B 相视在电能  格式：int32，单位：0.01kVAh
		String kVAh2 = upLoadData.substring(index, index + 8);
		result.setKVAh2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kVAh2), new BigDecimal("0.01")));
		index += 8;
		//B 相第一象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ1_2 = upLoadData.substring(index, index + 8);
		result.setKvarhQ1_2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ1_2), new BigDecimal("0.01")));
		index += 8;
		//B 相第二象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ2_2 = upLoadData.substring(index, index + 8);
		result.setKvarhQ2_2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ2_2), new BigDecimal("0.01")));
		index += 8;
		//B 相第三象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ3_2 = upLoadData.substring(index, index + 8);
		result.setKvarhQ3_2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ3_2), new BigDecimal("0.01")));
		index += 8;
		//B 相第四象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ4_2 = upLoadData.substring(index, index + 8);
		result.setKvarhQ4_2(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ4_2), new BigDecimal("0.01")));
		index += 8;
		//C 相正向有功电能  格式：int32，单位：0.01kWh
		String kWhImp3 = upLoadData.substring(index, index + 8);
		result.setKWhImp3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhImp3), new BigDecimal("0.01")));
		index += 8;
		//C 相反向有功电能  格式：int32，单位：0.01kWh
		String kWhExp3 = upLoadData.substring(index, index + 8);
		result.setKWhExp3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhExp3), new BigDecimal("0.01")));
		index += 8;
		//C 相有功电能净值  格式：int32，单位：0.01kWh
		String kWhNet3 = upLoadData.substring(index, index + 8);
		result.setKWhNet3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhNet3), new BigDecimal("0.01")));
		index += 8;
		//C 相有功电能总和  格式：int32，单位：0.01kWh
		String kWhTot3 = upLoadData.substring(index, index + 8);
		result.setKWhTot3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kWhTot3), new BigDecimal("0.01")));
		index += 8;
		//C 相正向无功电能  格式：int32，单位：0.01kvarh
		String kvarhImp3 = upLoadData.substring(index, index + 8);
		result.setKvarhImp3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhImp3), new BigDecimal("0.01")));
		index += 8;
		//C 相反向无功电能  格式：int32，单位：0.01kvarh
		String kvarhExp3 = upLoadData.substring(index, index + 8);
		result.setKvarhExp3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhExp3), new BigDecimal("0.01")));
		index += 8;
		//C 相无功电能净值  格式：int32，单位：0.01kvarh
		String kvarhNet3 = upLoadData.substring(index, index + 8);
		result.setKvarhNet3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhNet3), new BigDecimal("0.01")));
		index += 8;
		//C 相无功电能总和  格式：int32，单位：0.01kvarh
		String kvarhTot3 = upLoadData.substring(index, index + 8);
		result.setKvarhTot3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhTot3), new BigDecimal("0.01")));
		index += 8;
		//C 相视在电能  格式：int32，单位：0.01kVAh
		String kVAh3 = upLoadData.substring(index, index + 8);
		result.setKVAh3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kVAh3), new BigDecimal("0.01")));
		index += 8;
		//C 相第一象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ1_3 = upLoadData.substring(index, index + 8);
		result.setKvarhQ1_3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ1_3), new BigDecimal("0.01")));
		index += 8;
		//C 相第二象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ2_3 = upLoadData.substring(index, index + 8);
		result.setKvarhQ2_3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ2_3), new BigDecimal("0.01")));
		index += 8;
		//C 相第三象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ3_3 = upLoadData.substring(index, index + 8);
		result.setKvarhQ3_3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ3_3), new BigDecimal("0.01")));
		index += 8;
		//C 相第四象限无功电能  格式：int32，单位：0.01kvarh
		String kvarhQ4_3 = upLoadData.substring(index, index + 8);
		result.setKvarhQ4_3(DataConvertUtils.converInt2Float(NumberDataConvertUtils.hexString2decimalInt(kvarhQ4_3), new BigDecimal("0.01")));
		index += 8;
		
		return result;
	}
}
